package com.dao;

import com.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserDao {
    @Insert("insert into demo1 set values(#{id},#{username})")
    public void save(User user);

    @Update("update demo1 set username=#{username} where id=#{id}")
    public void update(User user);

    @Delete("delete from demo1 where id=#{id}")
    public void delete(Integer id);

    @Select("select * from demo1 where id=#{id}")
    public User getById(Integer id);

    @Select("select * from demo1")
    public List<User> getAll();
}
